<% title "Schedules" %>

<% idFileRedBee = SelectFile.where(:server => "RedBee").first.id%>
<% idSIT = ServiceInformationTable.where(:select_file_id => idFileRedBee).first.id %>
<% idPLT = ProgramLocationTable.where(:select_file_id => idFileRedBee).first.id%>
<% idPIT = ProgramInformationTable.where(:select_file_id => idFileRedBee).first.id%>
<% listOfServices = ServiceInformation.where(:service_information_table_id=>idSIT)%>

<table>
  <tr>
    <th>Channel name</th>
    <th>Start</th>
    <th>End</th>
  </tr>
  <% for service in listOfServices %>
  	<%
  	
  	%>
    <tr>
      <td><%= service.name %></td>
      	<td><%= Schedule.where(:program_location_table_id=>idPLT).where(:service_id=>service.serviceId).first.start.first(10) %></td>
      	<td><%= Schedule.where(:program_location_table_id=>idPLT).where(:service_id=>service.serviceId).first.end.first(10)  %></td>
    </tr>
  <% end %>
</table>

